<table class="symbols lr1-table">
  <colgroup>
    <col>
  </colgroup>
  <colgroup class="t">
    <%= Helpers.repeatString("<col>", Set.count(info.terminals) + 1) %>
  </colgroup>
  <colgroup class="nt">
    <%= Helpers.repeatString("<col>", Set.count(info.nonterminals)) %>
  </colgroup>
  
  <tr>
    <th>State</th>
    <% info.terminalOrder.forEach(function(symbol) { %>
      <th><%= Helpers.formatSymbol(symbol, info) %></th>
    <% }) %>
    <th><%= Helpers.formatSymbol(Grammar.END, info) %></th>
    <% info.nonterminalOrder.forEach(function(symbol) { %>
      <th><%= Helpers.formatSymbol(symbol, info) %></th>
    <% }) %>
  </tr>
  
  <% table.forEach(function(state, index) { %>
    <tr>
      <th scope="row"><%= index %></td>
      <% info.terminalOrder.concat(Grammar.END).forEach(function(s) { %>
        <% if (typeof state[s] === "undefined") { print("<td></td>"); return; } %>
        
        <td class="<%= (typeof state[s].shift === "undefined" ? 0 : 1) + (typeof state[s].reduce !== "undefined" ? state[s].reduce.length : 0) > 1 ? "conflict" : "" %>">
          <ul>
            <% if (typeof state[s].shift !== "undefined") { %>
              <li>shift(<%= state[s].shift %>)</li>
            <% } %>
            <% if (typeof state[s].reduce !== "undefined") { %>
              <% state[s].reduce.forEach(function(p) { %>
                <% if (p === -1) { %>
                  <li>accept</li>
                <% } else { %>
                  <li>reduce(<%= Helpers.formatProduction(productions[p], info) %>)</li>
                <% } %>
              <% }) %>
            <% } %>
          </ul>
        </td>
      <% }) %>
      <% info.nonterminalOrder.forEach(function(s) { %>
        <% if (typeof state[s] === "undefined") { print("<td></td>"); return; } %>
        
        <td>
          <ul>
            <% if (typeof state[s].shift !== "undefined") { %>
              <li><%= state[s].shift %></li>
            <% } %>
          </ul>
        </td>
      <% }) %>
    </tr>
  <% }) %>
</table>
